<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <title>vue-form_submit</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css"
        integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <style>
        .green {
            color: green;
        }
    </style>
</head>

<body>
    <div id="app" class="container">
        <div>
            <ul>
                <li v-for="item in language" v-on:click="finshed(item.id)" v-bind:class="{green:item.best}">
                    {{item.name}}:{{item.desc}}
                </li>
            </ul>
        </div>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        data: {
            language: [
                { id: 1, name: 'php', desc: 'web语言', best: false },
                { id: 2, name: 'java', desc: '企业应用语言', best: false },
                { id: 3, name: 'c语言', desc: '操作系统语言', best: false }
            ],
            isgreen: true
        },
        methods: {
            finshed: function (item_id) {
                let language = this.language.find((item) => { return item.id == item_id });
                if(language.best==false){
                    language.best=true
                }else{
                    language.best=false
                }
            }
        }
    })
</script>

</html>